using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using TVAnyTimeClassLibrary;

namespace BTV.Base
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1705:LongAcronymsShouldBePascalCased")]
    public class BTVProgram
    {
        private string _pid;
        private string _name;
        private Dictionary<string, List<string>> _relatedInfo = new Dictionary<string, List<string>>();
        private Dictionary<string, string> _av = new Dictionary<string, string>();
        private string _series;
        private List<BTVSchedule> _schedule;

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")]
        public List<BTVSchedule> Schedules
        {
            get { return _schedule; }
        }

        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
            }
        }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
        public Dictionary<string, List<string>> RelatedInfo
        {
            get
            {
                return _relatedInfo;
            }
        }

        public string Series
        {
            get
            {
                return _series;
            }
            set
            {
                _series = value;
            }
        }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1705:LongAcronymsShouldBePascalCased", MessageId = "Member")]
        public string PID
        {
            get
            {
                return _pid;
            }
            set
            {
                _pid = value;
            }
        }

        public void AddSynopsis(string type, string data)
        {
            AddSynopsis(type as object, data as object);
        }

        public void AddSynopsis(SynopsisType type)
        {
            AddSynopsis(type, null);
        }

        public virtual void AddSynopsis(object a, object b) { }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1807:AvoidUnnecessaryStringCreation", MessageId = "type")]
        public string GetSynopsis(string type)
        {
            switch ( type.ToLower() )
            {
                case "long":
                    return GetLongSynopsis(true);
                case "short":
                    return GetShortSynopsis(true);
                default:
                    return "No Synopsis Available";
            }
        }

        public virtual string GetShortSynopsis(bool tryLong){return "No Synopsis Available";}
        public virtual string GetLongSynopsis(bool tryShort){return "No Synopsis Available";}

        public string GetLongSynopsis()
        {
            return GetLongSynopsis(true);
        }

        public string GetShortSynopsis()
        {
            return GetShortSynopsis(true);
        }

        public void AddRelatedInfo(string type, string data)
        {
            if (type == null)
                type = "";
            List<string> r = new List<string>();
            if ( _relatedInfo.TryGetValue(type, out r) )
            {
                r.Add(data);
            }
            else
            {
                r = new List<string>();
                r.Add(data);
                _relatedInfo.Add(type, r);
            }
        }

        public void AddAVInfo(string type, string data)
        {
            _av.Add(type, data);
        }

        public override string ToString()
        {
            return Name;
        }
    }
}